<div class="page-crumb">
	<div class="ui-ctrl ui-crumb"><span class="ui-crumb-node ui-crumb-node-first ui-crumb-node-last">修改代码位</span></div>
</div>

<div class="layui-main">
	<form class="layui-form" action="" onsubmit="return false">
		   <input type="hidden" style="width:300px" name="id" value="{$code['id']}">
		<div class="layui-form-item">
			<label class="layui-form-label">代码位名称：</label>
			<div class="layui-input-inline">
				<input type="text" name="code_name" lay-verify="code_name" autocomplete="off" placeholder="" class="layui-input" value="{$code['code_name']}">
			</div>
			<div class="layui-form-mid layui-word-aux">最多可输入60个字符</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">选择媒体：</label>
			<div class="layui-input-inline">

			  <select name="media_id" lay-verify="media" lay-filter="media">

				<option value=""></option>
				  <foreach name="result" item="ret" key="k">
                            <option value="{$ret.id}" <if condition="$code['media_id'] eq $ret['id']"> selected="selected" </if> >{$ret.name}</option>
                        </foreach>
			  </select>
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">选择分组：</label>
			<div class="layui-input-inline">
			  <select name="group_id"   id="group_id">

				<option value=""></option>
				   <foreach name="group" item="gro" key="k">
                            <option value="{$gro.id}" <if condition="$code['group_id'] eq $gro['id']"> selected="selected" </if> >{$gro.group_name}</option>
                   </foreach>

			  </select>
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">标签：</label>
			<div class="layui-input-inline">
				<input type="text" name="tag" autocomplete="off" placeholder="" class="layui-input" value="{$code['tag']}">
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">载体类型：</label>
			<div class="layui-input-block">
				<div class="ui-box-group">
					<input type="radio" name="flow_type" value="1" title="H5"  <?php if($code['flow_type'] == '1') echo 'checked="checked"'; ?>  >
					<input type="radio" name="flow_type" value="2" title="移动端" <?php if($code['flow_type'] == '2') echo 'checked="checked"'; ?> >
				</div>
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">代码位尺寸：</label>
			<div class="layui-input-block">
				<div class="migrate-warning">
					<p>注意：该设置将限制广告图片的大小 单位(PX)</p>
				</div>
				<div class="code-size-panel">
					<div class="custom-size-wrap">
						<div class="size-box">
							<label class="size-label">宽：</label>
							<input class="size-width size-input" type="text" lay-verify="width"  name="width" value="{$code['width']}">
						</div>
						<div class="size-box">
							<label class="size-label">高：</label>
							<input class="size-height size-input" type="text" lay-verify="size_height"  name="height" value="{$code['height']}">
						</div>
					</div>
				</div>
			</div>
		</div>
		
		<div class="layui-form-item">
			<label class="layui-form-label">计费方式：</label>
			<div class="layui-input-block">
			  <input type="radio" name="charge"  lay-filter="charge" value="0" data-state=""		title="不设置" <?php if($code['charge'] == '0') echo 
			  'checked="checked"'; ?> >
			  <input type="radio" name="charge"  lay-filter="charge" value="1" data-state="cpd" 	title="CPD" <?php if($code['charge'] == '1') echo 'checked="checked"'; ?> >
			  <input type="radio" name="charge" lay-filter="charge"	value="2" data-state="cpm" 	title="CPM" <?php if($code['charge'] == '2') echo 'checked="checked"'; ?> >
			  <input type="radio" name="charge"  lay-filter="charge"	value="3" data-state="cpc" 	title="CPC" <?php if($code['charge'] == '3') echo 'checked="checked"'; ?> >
			</div>
		</div>
		
		<style>
			.rate-box, .discount-box {
				display: none;
			}
			
			.rate-box .layui-input-inline {
				width: 500px;
				position: relative;
				display: inline-block;
			}
			
			.rate-box .layui-input-inline .layui-input {
				display: inline-block;
				width: 230px;    
			}
			
			.layui-form-item.state-cpd .layui-input-inline::after {
				content: '元/每天';
				margin-left: 5px;
			}
			
			.layui-form-item.state-cpm .layui-input-inline::after {
				content: '元/千次展现';
				margin-left: 5px;
			}
			
			.layui-form-item.state-cpc .layui-input-inline::after {
				content: '元/单次点击';
				margin-left: 5px;
			}
			
			.layui-form-item .ui-input-unit {
				display: inline-block;
				padding: 9px 0;
			}

		</style>
		
		<?php 
			$className = $styleShow = '';
			$state = [
				1 =>	'cpd',
				2 =>	'cpm',
				3 =>	'cpc'
			];
			
			if( isset($state[$code['charge']]) ) {
				$className = 'state-' . $state[$code['charge']];
				$styleShow = 'style="display:block"';
			}
			
			
	
		?>
		
		<div class="layui-form-item rate-box {$className}" {$styleShow}>
			<label class="layui-form-label">刊例价：</label>
			<div class="layui-input-inline">
				<input type="text" name="rate" lay-verify="rate" autocomplete="off" placeholder="" class="layui-input" value="{$code['rate']}">
			</div>
		</div>
		
		<div class="layui-form-item discount-box" {$styleShow}>
			<label class="layui-form-label">折扣率：</label>
			<div class="layui-input-inline">
				<input type="text" name="discount" lay-verify="discount" autocomplete="off" placeholder="" class="layui-input" value="{$code['discount']}">  
			</div>
			<span class="ui-input-unit">%</span>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">变现合作：</label>
			<div class="layui-input-block">
				<input type="checkbox" name="rtbcomplement" value="1" lay-skin="primary" title="新美广告交易服务" checked="">
				<div class="layui-unselect layui-form-checkbox " lay-skin="primary">
					<span>新美广告交易服务</span><i class="layui-icon"></i>
				</div>
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
			  <button class="layui-btn" lay-submit="" lay-filter="submit">　　保存　　</button>
			  <button class="layui-btn layui-btn-primary close-btn" onclick="PopModel.closeFrame();">取消</button>
			</div>
		</div>
		
	</form>
	
</div>
<script src="__BACKEND_STATIC__/js/code/edit.js"></script>


